// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   SourceFile

package com.sgame.android.data;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

import org.json.JSONException;
import org.json.JSONObject;

public class MBUUser extends User
{
    public static enum Field
    {
	     ID, USER_ID, DISPLAY_NAME, NICKNAME, THUMBNAIL_URL, ABOUT_ME, HAS_APP, AGE_RESTRICTED, AGE, MUTUAL_FRIENDS, 
	     PENDING_FRIEND_REQUESTS, ADDRESSES, GAMERTAG, BADGE_ID, FIRST_NAME, LAST_NAME, DESCRIPTION, VALIDATED, UUID, OPTIN, 
	     PHOTO_URL, EMAIL, GENDER, UNREAD_WALL_POST_COUNT, GAMERSCORE, GRADE, LEVEL_NUMBER, LEVEL_NAME, LEVEL_POINTS, NEXT_LEVEL_SCORE, 
	     SESSION_COUNT, IS_NUX_COMPLETE, IS_MOBAGE_USER, IS_GAMEHUB_USER, IS_NEW_BUDDY, PRIVACY_FLAG, HIDE_PRESENCE_FLAG, IGNORE_FRIEND_REQUESTS_FLAG, ONLY_SHOW_FRIEND_NOTIFICATIONS, FILTER_WALL_POSTS_TO_FRIENDS_ONLY, 
	     RELATION
    }


    public MBUUser()
    {
        a = "";
        mFirstName = "";
        mLastName = "";
        d = "";
        e = "";
        f = "";
        g = "";
        h = "";
        i = "";
        j = "";
        k = "";
        mUUID = "";
        n = false;
        o = "";
        mEmail = "";
        q = "";
        v = "";
    }

    public String getThumbnailUrl()
    {
        if(o.length() != 0)
            return o;
        if(f.length() != 0)
            return f;
        else
            return super.getThumbnailUrl();
    }

    public String getBirthday()
    {
        return e;
    }

    public void setBirthday(String birthday)
    {
        e = birthday;
    }

    public final String a()
    {
        return q;
    }

    public final void a(String s1)
    {
        q = s1;
    }

    public final boolean b()
    {
        return l;
    }

    public final void a(boolean flag)
    {
        l = flag;
    }

    public static MBUUser getFromJson(JSONObject jsonobject) //b
    {
        MBUUser mbuuser;
        (mbuuser = new MBUUser()).setFromJson(jsonobject);
        mbuuser.setJsonObject(jsonobject);
        return mbuuser;
    }
 
    public void setFromJson(JSONObject json)
    {
        super.setFromJson(json);
        setId(json.optString(Field.USER_ID.name()));
        if(getId() == null || getId().length() == 0)
            setId(json.optString(Field.ID.name()));
        a = json.optString(Field.GAMERTAG.name());
        setDisplayName((new StringBuilder()).append(json.optString(Field.FIRST_NAME.name())).append(json.optString(Field.LAST_NAME.name())).toString());
        mFirstName = json.optString(Field.FIRST_NAME.name());
        mLastName = json.optString(Field.LAST_NAME.name());
        setNickname(json.optString(Field.NICKNAME.name(), json.optString(Field.GAMERTAG.name())));
        setThumbnailUrl(json.optString(Field.THUMBNAIL_URL.name()));
        f = json.optString(Field.BADGE_ID.name());
        l = json.optBoolean(Field.VALIDATED.name());
        d = json.optString(Field.ADDRESSES.name());
        setAboutMe(json.optString(Field.ABOUT_ME.name()));
        setAge(json.optInt(Field.AGE.name()));
        q = json.optString(Field.GENDER.name());
        setHasApp(json.optBoolean(Field.HAS_APP.name()));
        k = json.optString(Field.DESCRIPTION.name());
        mUUID = json.optString(Field.UUID.name());
        n = json.optBoolean(Field.OPTIN.name());
        o = json.optString(Field.PHOTO_URL.name());
        mEmail = json.optString(Field.EMAIL.name());
        q = json.optString(Field.GENDER.name());
        setAgeRestricted(json.optBoolean(Field.AGE_RESTRICTED.name()));
        r = json.optInt(Field.UNREAD_WALL_POST_COUNT.name());
        s = json.optInt(Field.GAMERSCORE.name());
        setGrade(json.optInt(Field.GRADE.name()));
        u = json.optInt(Field.LEVEL_NUMBER.name());
        v = json.optString(Field.LEVEL_NAME.name());
        w = json.optInt(Field.LEVEL_POINTS.name());
        x = json.optInt(Field.NEXT_LEVEL_SCORE.name());
        y = json.optInt(Field.SESSION_COUNT.name());
        z = json.optBoolean(Field.IS_NUX_COMPLETE.name());
        A = json.optBoolean(Field.IS_MOBAGE_USER.name());
        B = json.optBoolean(Field.IS_GAMEHUB_USER.name());
        C = json.optBoolean(Field.PRIVACY_FLAG.name());
        D = json.optBoolean(Field.HIDE_PRESENCE_FLAG.name());
        E = json.optBoolean(Field.IGNORE_FRIEND_REQUESTS_FLAG.name());
        F = json.optBoolean(Field.ONLY_SHOW_FRIEND_NOTIFICATIONS.name());
        G = json.optBoolean(Field.FILTER_WALL_POSTS_TO_FRIENDS_ONLY.name());
        H = json.optBoolean(Field.MUTUAL_FRIENDS.name());
        I = json.optBoolean(Field.IS_NEW_BUDDY.name());
    }

    public JSONObject toJson()
    {
    	JSONObject obj = new JSONObject();
    	try
    	{
	        obj.put(Field.USER_ID.name(), getId());
	        obj.put(Field.DISPLAY_NAME.name(), getDisplayName());
	        obj.put(Field.FIRST_NAME.name(), mFirstName);
	        obj.put(Field.LAST_NAME.name(), mLastName);
	        if(getNickname().length() > 0)
	            obj.put(Field.NICKNAME.name(), getNickname());
	        obj.put(Field.THUMBNAIL_URL.name(), getThumbnailUrl());
	        obj.put(Field.VALIDATED.name(), l);
	        obj.put(Field.HAS_APP.name(), isHasApp());
	        obj.put(Field.BADGE_ID.name(), f);
	        obj.put(Field.AGE_RESTRICTED.name(), getIsAgeRestricted());
	        obj.put(Field.VALIDATED.name(), l);
	        obj.put(Field.ADDRESSES.name(), d);
	        obj.put(Field.ABOUT_ME.name(), getAboutMe());
	        obj.put(Field.AGE.name(), getAge());
	        obj.put(Field.GENDER.name(), q);
	        obj.put(Field.DESCRIPTION.name(), k);
	        obj.put(Field.UUID.name(), mUUID);
	        obj.put(Field.OPTIN.name(), n);
	        obj.put(Field.PHOTO_URL.name(), o);
	        if(a.length() > 0)
	            obj.put(Field.GAMERTAG.name(), a);
	        obj.put(Field.EMAIL.name(), mEmail);
	        obj.put(Field.UNREAD_WALL_POST_COUNT.name(), r);
	        obj.put(Field.GAMERSCORE.name(), s);
	        obj.put(Field.GRADE.name(), getGrade());
	        obj.put(Field.LEVEL_NUMBER.name(), u);
	        obj.put(Field.LEVEL_NAME.name(), v);
	        obj.put(Field.LEVEL_POINTS.name(), w);
	        obj.put(Field.NEXT_LEVEL_SCORE.name(), x);
	        obj.put(Field.SESSION_COUNT.name(), y);
	        obj.put(Field.IS_NUX_COMPLETE.name(), z);
	        obj.put(Field.IS_MOBAGE_USER.name(), A);
	        obj.put(Field.IS_GAMEHUB_USER.name(), B);
	        obj.put(Field.PRIVACY_FLAG.name(), C);
	        obj.put(Field.HIDE_PRESENCE_FLAG.name(), D);
	        obj.put(Field.IGNORE_FRIEND_REQUESTS_FLAG.name(), E);
	        obj.put(Field.ONLY_SHOW_FRIEND_NOTIFICATIONS.name(), F);
	        obj.put(Field.FILTER_WALL_POSTS_TO_FRIENDS_ONLY.name(), G);
	        obj.put(Field.MUTUAL_FRIENDS.name(), H);
	        obj.put(Field.IS_NEW_BUDDY.name(), I);
		}
    	catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        return obj;
    }

    public JSONObject toJsonForUnity()
    {
    	JSONObject obj = new JSONObject();
        try {
	        obj.put(Field.USER_ID.name(), getId());
	        obj.put(Field.DISPLAY_NAME.name(), getDisplayName());
	        obj.put(Field.FIRST_NAME.name(), mFirstName);
	        obj.put(Field.LAST_NAME.name(), mLastName);
	        obj.put(Field.NICKNAME.name(), getNickname());
	        obj.put(Field.THUMBNAIL_URL.name(), getThumbnailUrl());
	        obj.put(Field.VALIDATED.name(), l);
	        obj.put(Field.HAS_APP.name(), isHasApp());
	        obj.put(Field.THUMBNAIL_URL.name(), getThumbnailUrl());
	        obj.put(Field.AGE_RESTRICTED.name(), getIsAgeRestricted());
	        obj.put(Field.VALIDATED.name(), l);
	        obj.put(Field.ADDRESSES.name(), d);
	        obj.put(Field.ABOUT_ME.name(), getAboutMe());
	        obj.put(Field.AGE.name(), getAge());
	        obj.put(Field.GENDER.name(), q);
	        obj.put(Field.HAS_APP.name(), super.isHasApp());
	        obj.put(Field.DESCRIPTION.name(), k);
	        obj.put(Field.UUID.name(), mUUID);
	        obj.put(Field.OPTIN.name(), n);
	        obj.put(Field.PHOTO_URL.name(), o);
	        obj.put(Field.GAMERTAG.name(), a);
	        obj.put(Field.EMAIL.name(), mEmail);
	        obj.put(Field.AGE_RESTRICTED.name(), getIsAgeRestricted());
	        obj.put(Field.UNREAD_WALL_POST_COUNT.name(), r);
	        obj.put(Field.GAMERSCORE.name(), s);
	        obj.put(Field.GRADE.name(), getGrade());
	        obj.put(Field.LEVEL_NUMBER.name(), u);
	        obj.put(Field.LEVEL_NAME.name(), v);
	        obj.put(Field.LEVEL_POINTS.name(), w);
	        obj.put(Field.NEXT_LEVEL_SCORE.name(), x);
	        obj.put(Field.SESSION_COUNT.name(), y);
	        obj.put(Field.IS_NUX_COMPLETE.name(), z);
	        obj.put(Field.IS_MOBAGE_USER.name(), A);
	        obj.put(Field.IS_GAMEHUB_USER.name(), B);
	        obj.put(Field.PRIVACY_FLAG.name(), C);
	        obj.put(Field.HIDE_PRESENCE_FLAG.name(), D);
	        obj.put(Field.IGNORE_FRIEND_REQUESTS_FLAG.name(), E);
	        obj.put(Field.ONLY_SHOW_FRIEND_NOTIFICATIONS.name(), F);
	        obj.put(Field.FILTER_WALL_POSTS_TO_FRIENDS_ONLY.name(), G);
	        obj.put(Field.MUTUAL_FRIENDS.name(), H);
			obj.put(Field.IS_NEW_BUDDY.name(), I);
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        return obj;
    }

    public final String c()
    {
        return d;
    }

    public final void b(String s1)
    {
        d = s1;
    }

    public final String getFirstName()
    {
        return mFirstName;
    }

    public final void setFirstName(String s1)
    {
    	mFirstName = s1;
    }

    public final String getLastName()
    {
        return mLastName;
    }

    public final void d(String s1)
    {
        mLastName = s1;
    }

    public final String f()
    {
        return k;
    }

    public final void e(String s1)
    {
        k = s1;
    }

    public final String getUUID() //g
    {
        return mUUID;
    }

    public final void setUUID(String s1) //f
    {
        mUUID = s1;
    }

    public final boolean h()
    {
        return n;
    }

    public final void b(boolean flag)
    {
        n = flag;
    }

    public final String i()
    {
        return o;
    }

    public final void g(String s1)
    {
        o = s1;
    }

    public final String getEmail() //j
    {
        return mEmail;
    }

    public final void setEmail(String s1) //h
    {
        mEmail = s1;
    }

    public final String k()
    {
        return a;
    }

    public final void i(String s1)
    {
        a = s1;
    }

    public final String l()
    {
        return f;
    }

    public final void j(String s1)
    {
        f = s1;
    }

    public final int m()
    {
        return r;
    }

    public final void a(int i1)
    {
        r = i1;
    }

    public final int n()
    {
        return s;
    }

    public final void b(int i1)
    {
        s = i1;
    }

    public int getGrade()
    {
        return t;
    }

    public void setGrade(int grade)
    {
        t = grade;
    }

    public final int o()
    {
        return u;
    }

    public final void c(int i1)
    {
        u = i1;
    }

    public final String p()
    {
        return v;
    }

    public final void k(String s1)
    {
        v = s1;
    }

    public final int q()
    {
        return x;
    }

    public final void d(int i1)
    {
        x = i1;
    }

    public final boolean r()
    {
        return G;
    }

    public final void c(boolean flag)
    {
        G = flag;
    }

    public final boolean s()
    {
        return F;
    }

    public final void d(boolean flag)
    {
        F = flag;
    }

    public final boolean t()
    {
        return E;
    }

    public final void e(boolean flag)
    {
        E = flag;
    }

    public final boolean u()
    {
        return D;
    }

    public final void f(boolean flag)
    {
        D = flag;
    }

    public final boolean v()
    {
        return C;
    }

    public final void g(boolean flag)
    {
        C = flag;
    }

    public final boolean w()
    {
        return B;
    }

    public final void h(boolean flag)
    {
        B = flag;
    }

    public final int x()
    {
        return y;
    }

    public final void e(int i1)
    {
        y = i1;
    }

    public final boolean y()
    {
        return z;
    }

    public final void i(boolean flag)
    {
        z = flag;
    }

    public final boolean z()
    {
        return A;
    }

    public final void j(boolean flag)
    {
        A = flag;
    }

    public final boolean A()
    {
        return H;
    }

    public final void k(boolean flag)
    {
        H = flag;
    }

    public final int B()
    {
        return w;
    }

    public final void f(int i1)
    {
        w = i1;
    }

    public final boolean C()
    {
        return I;
    }

    public final void l(boolean flag)
    {
        I = flag;
    }

    public static boolean setNickname(Context context, String s1) // a
    {
        boolean flag = false;
        Editor editor = context.getSharedPreferences("guest_user", 0).edit();
        if(s1 != null && s1.length() > 0)
        {
        	editor.putString("nickname", s1);
            flag = editor.commit();
        }
        return flag;
    }

    public static boolean setPassword(Context context, String s1) // b
    {
        boolean flag = false;
        Editor editor = context.getSharedPreferences("guest_user", 0).edit();
        if(s1 != null && s1.length() > 0)
        {
        	editor.putString("password", s1);
            flag = editor.commit();
        }
        return flag;
    }

    public static String getNickname(Context context) //g
    {
        return context.getSharedPreferences("guest_user", 0).getString("nickname", null);
    }

    public static String getPassword(Context context) // b
    {
        return context.getSharedPreferences("guest_user", 0).getString("password", null);
    }

    public static boolean Commit(Context context) //c 
    {
        return context.getSharedPreferences("guest_user", 0).edit().clear().commit();
    }
    // a:gamertag, b:firstname, c:lastname, d:address, l:validate, f:badge_id, q:gender
    // k:description, m:uuid, n:optin, o:photo_url, p:email, r:unread post count,
    // s:gamescore, v:level_name, w: level_points, x:next_level_score, y:session_count
    // A:is_sgame_user, B:is_gamehub_user, E: ignore_friend_request, F:only_show_friend_notification
    // G: filter_wall_post_to_friends_only, H: mutual_friends, I: is_new_buddy

    private String a;
    private String mFirstName;
    private String mLastName;
    private String d;
    private String e;
    private String f;
    private String g;
    private String h;
    private String i;
    private String j;
    private String k;
    private boolean l;
    private String mUUID;
    private boolean n;
    private String o;
    private String mEmail;
    private String q;
    private int r;
    private int s;
    private int t;
    private int u;
    private String v;
    private int w;
    private int x;
    private int y;
    private boolean z;
    private boolean A;
    private boolean B;
    private boolean C;
    private boolean D;
    private boolean E;
    private boolean F;
    private boolean G;
    private boolean H;
    private boolean I;
}
